﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace PSE.Framework.Data.Oracle.Configuration
{
    public class OracleConnectionStringSection : ConfigurationSection
    {
        [ConfigurationProperty("pooling", IsRequired = true)]
        public bool Pooling
        {
            get
            {
                return (bool)this["pooling"];
            }
        }

        [ConfigurationProperty("minPoolSize", IsRequired = false)]
        public int? MinPoolSize
        {
            get
            {
                if (this["minPoolSize"] != null)
                {
                    return (int)this["minPoolSize"];
                }
                else
                {
                    return null;
                }
            }
        }

        [ConfigurationProperty("maxPoolSize", IsRequired = false)]
        public int? MaxPoolSize
        {
            get
            {
                if (this["maxPoolSize"] != null)
                {
                    return (int)this["maxPoolSize"];
                }
                else
                {
                    return null;
                }
            }
        }

        [ConfigurationProperty("connectionTimeout", IsRequired = false)]
        public int? ConnectionTimeout
        {
            get
            {
                if (this["connectionTimeout"] != null)
                {
                    return (int)this["connectionTimeout"];
                }
                else
                {
                    return null;
                }
            }
        }

        [ConfigurationProperty("connectionLifetime", IsRequired = false)]
        public int? ConnectionLifetime
        {
            get
            {
                if (this["connectionLifetime"] != null)
                {
                    return (int)this["connectionLifetime"];
                }
                else
                {
                    return null;
                }
            }
        }

        [ConfigurationProperty("decrementPoolSize", IsRequired = false)]
        public int? DecrementPoolSize
        {
            get
            {
                if (this["decrementPoolSize"] != null)
                {
                    return (int)this["decrementPoolSize"];
                }
                else
                {
                    return null;
                }
            }
        }

        [ConfigurationProperty("incrementPoolSize", IsRequired = false)]
        public int? IncrementPoolSize
        {
            get
            {
                if (this["incrementPoolSize"] != null)
                {
                    return (int)this["incrementPoolSize"];
                }
                else
                {
                    return null;
                }
            }
        }

        [ConfigurationProperty("password", IsRequired = true)]
        public string Password
        {
            get
            {
                return (string)this["password"];
            }
        }

        [ConfigurationProperty("userID", IsRequired = true)]
        public string UserId
        {
            get
            {
                return (string)this["userID"];
            }
        }

        [ConfigurationProperty("dataSource", IsRequired = true)]
        public string DataSource
        {
            get
            {
                return (string)this["dataSource"];
            }
        }

        [ConfigurationProperty("persistSecurityInfo", IsRequired = true)]
        public bool PersistSecurityInfo
        {
            get
            {
                return (bool)this["persistSecurityInfo"];
            }
        }
    }
}
